#include <thread>
#include <iostream>
#include "processor.hpp"
#include "macro.hpp"


void run_in_coroutine2() {
    LOG_CO("run_in_coroutine2 begin");
    LOG_CO("run_in_coroutine2 end");
}

void run_in_coroutine1() {
    LOG_CO("run_in_coroutine1 begin");
    LOG_CO("run_in_coroutine1 end");
    jizhe::Processor::schedule(run_in_coroutine2);
}


int main() {
    
    jizhe::Processor p1;
    p1.addTask(run_in_coroutine1);
    auto t1 = std::thread(std::bind(&jizhe::Processor::run, &p1));

    jizhe::Processor p2;
    p2.addTask(run_in_coroutine1);
    auto t2 = std::thread(std::bind(&jizhe::Processor::run, &p2));

    t1.join();
    t2.join();

}